Root Zanli
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
o5t6x7pgljbm
/
public_html
/
admin
/
app
/
V2
/
Services
/
Filename :
SPWalletService.php
back
Copy
<?php namespace App\V2\Services; use App\Http\Controllers\Api\SPWalletController; use App\Models\TUIT\TuitAllocationConfig; use App\Models\User; use Carbon\Carbon; use Exception; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; class SPWalletService extends BaseService{ private $spWalletController; public function __construct(){ $this->spWalletController = new SPWalletController(); } public function awardSpToWallet(User $user, $points, $transaction_title, $description, $ref_table, $ref_table_id){ $spWalletTransaction = $this->spWalletController->creditSP($user, $points, [ 'transaction_title' => $transaction_title, 'ref_table' => $ref_table, 'ref_table_id' => $ref_table_id, 'description' => $description == null ? "Awarded points: $points" : $description, ]); } public function deductSpFromWallet(User $user, $points, $transaction_title, $description, $ref_table, $ref_table_id){ $spWalletTransaction = $this->spWalletController->debitSP($user, $points, [ 'transaction_title' => $transaction_title, 'ref_table' => $ref_table, 'ref_table_id' => $ref_table_id, 'description' => $description == null ? "Deducted points: $points" : $description, ]); } public function getSPWallet(User $user){ return $this->spWalletController->getSPWallet($user); } public function getSPWalletLatestTransactions(User $user, $num_limit){ return $this->spWalletController->getSPWalletLatestTransactions($user, $num_limit); } } ?>